package com.koi.common.tree;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author ･ᴗ･
 * @description [PermissionBo]
 */
@Data
public class TreeTable {

    private String id;
    // 标题，前端需要什么改成什么
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String label;
    /**
     * ElementUI 标题，根据前端需要字段进行对应
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String name;
    private String parentId;
    // 类型编码：省，市，区（字典管理存放）
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String typeCode;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String status;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer sorted;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;
    @JsonInclude(JsonInclude.Include.NON_EMPTY)  // 显示不为空的数据，"child:[]",有这个会显示下拉图标
    private List<TreeTable> children = new ArrayList<>();
}
